/*
 * File Name：LSSViewPager.java
 * Copyright：Copyright 2008-2014 CiWong.Inc. All Rights Reserved.
 * Description： LSSViewPager.java
 * Modify By：jejun
 * Modify Date：2014-2-11
 * Modify Type：Add
 */
package com.ciwong.epaper.widget.evaluate;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * 自定义ViewPager
 * 
 * @author jejun
 * @version ciwong v.1.0 2014-2-11
 * @since ciwong v.1.0
 */
public class WorkViewPager extends ViewPager
{
    private boolean canScroll = true;

    public WorkViewPager(Context context)
    {
        super(context);
    } 
    public WorkViewPager(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }

    /**
     * 是否可以滚动
     * 
     * @param canScroll
     */
    public void setCanScroll(boolean canScroll)
    {
        this.canScroll = canScroll;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0)
    {
        if (canScroll)
        {
            return super.onInterceptTouchEvent(arg0);
        }
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent arg0)
    {
        if (canScroll)
        {
            return super.onTouchEvent(arg0);
        }
        return false;
    }
}
